/*
 * @Author: your name
 * @Date: 2021-05-11 16:52:45
 * @LastEditTime: 2021-05-12 13:31:52
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \koa2-serve\routes\users.js
 */
const router = require('koa-router')()
const user = require('./user.js')

router.prefix('/api')

const routers = require('require-all')({
  dirname : __dirname,
  filter  : function (fileName) {
    if (fileName === 'index.js') return;
    return fileName;
  }
});
Object.keys(routers).forEach((key)=>{
  routers[key].forEach((met)=>{
    router[met.method](met.url,...met.controller)
  })
})

module.exports = router
